//package com.funtl.myshop.service.reg.controller;
//
//import com.funtl.myshop.commons.domain.TbUser;
//import com.funtl.myshop.commons.dto.AbstractBaseResult;
//import com.funtl.myshop.commons.dto.BaseResultFactory;
//import com.google.common.collect.Lists;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.ConfigurableApplicationContext;
//import org.springframework.http.HttpStatus;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.List;
//
//@RestController
//@RequestMapping(value = "test")
//public class TestController {
//
//    @Autowired
//    private ConfigurableApplicationContext applicationContext;//动态刷新参数
//
//    @GetMapping(value = "records/{id}")
//    public AbstractBaseResult getById(HttpServletRequest request, @PathVariable long id) {
//        TbUser tbUser = new TbUser();
//        tbUser.setId(1L);
//        tbUser.setUsername("和谷桐人");
//
//        if (id == 1) {
//            return BaseResultFactory.getInstance().build(request.getRequestURI(), tbUser);
//        } else {
//            return BaseResultFactory.getInstance().build(HttpStatus.UNAUTHORIZED.value(), "参数类型错误", "ID 只能为 1", applicationContext.getEnvironment().getProperty("logging.level.com.funtl.myshop"));
//        }
//    }
//
//    @GetMapping(value = "records")
//    public AbstractBaseResult getList(HttpServletRequest request) {
//        TbUser tbUser1 = new TbUser();
//        tbUser1.setId(1L);
//        tbUser1.setUsername("和谷桐人");
//
//        TbUser tbUser2 = new TbUser();
//        tbUser2.setId(2L);
//        tbUser2.setUsername("亚丝娜");
//
//        List<TbUser> tbUsers = Lists.newArrayList();
//        tbUsers.add(tbUser1);
//        tbUsers.add(tbUser2);
//
//        return BaseResultFactory.getInstance().build(request.getRequestURI(), 2, 10, tbUsers);
//    }
//}